package com.zzy.face.dao;

import com.zzy.face.dto.StudentInfo;
import com.zzy.face.model.RLSchool;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author 朱泽玉
 * @Create 2022/1/29 11:05
 * @Description
 * @Modified By:
 */
@Repository
public interface RLSchoolDao extends JpaRepository<RLSchool,Long>, JpaSpecificationExecutor<RLSchool> {
    @Query(value = "SELECT * from rlschool where student_uid = ?1 and state != -2",nativeQuery = true)
    List<RLSchool> findRLSchoolByStudent(Long student);

    @Query(value = "SELECT * from rlschool where student_uid = ?1 and type=0 and state != -2",nativeQuery = true)
    List<RLSchool> findRSchoolByStudent(Long student);

    @Query(value = "SELECT * from rlschool where student_uid = ?1 and type=1 and state != -2",nativeQuery = true)
    List<RLSchool> findLSchoolByStudent(Long student);

    @Query(value = "SELECT * from rlschool where teacher_uid = ?1 and state != -2",nativeQuery = true)
    List<RLSchool> findRLSchoolByTeacher(Long teacher);

    @Query(value = "SELECT * from rlschool where teacher_uid = ?1 and type=0 and state != -2",nativeQuery = true)
    List<RLSchool> findRSchoolByTeacher(Long teacher);

    @Query(value = "SELECT * from rlschool where teacher_uid = ?1 and type=1 and state != -2",nativeQuery = true)
    List<RLSchool> findLSchoolByTeacher(Long teacher);


}
